package utils;

public class Lib {
	
	public static final void assertTrue(boolean assertion) {
		assert assertion : "";
	}
	
	public static final void assertTrue(boolean assertion, String msg) {
		assert assertion : msg;
	}
	
	public static final void assertNotReached() {
		assert false : "";
	}
	
	public static final void assertNotReached(String msg) {
		assert false : msg;
	}

	public static final int bytesToInt(byte[] bytes, int offset) {
		assertTrue(bytes.length >= 4, "bytesToInt: no enough bytes");

		return ((((int) bytes[0] << 24) & 0xFF000000)
				| (((int) bytes[1] << 16) & 0xFF0000)
				| (((int) bytes[2] << 8) & 0xFF00)
				| ((int) bytes[3] & 0xFF));
	}
	
}
